<?php

/**
 * characterTemplate form base class.
 *
 * @method characterTemplate getObject() Returns the current form's model object
 *
 * @package    wte
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasecharacterTemplateForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'introduced_by' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('characterTemplate'), 'add_empty' => true)),
      'name'          => new sfWidgetFormInputText(),
      'avatar'        => new sfWidgetFormInputText(),
      'desc_en'       => new sfWidgetFormInputText(),
      'desc_fr'       => new sfWidgetFormInputText(),
      'desc_ec'       => new sfWidgetFormInputText(),
      'rel_en'        => new sfWidgetFormInputText(),
      'rel_fr'        => new sfWidgetFormInputText(),
      'rel_es'        => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'introduced_by' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('characterTemplate'), 'required' => false)),
      'name'          => new sfValidatorString(array('max_length' => 63)),
      'avatar'        => new sfValidatorString(array('max_length' => 127, 'required' => false)),
      'desc_en'       => new sfValidatorPass(),
      'desc_fr'       => new sfValidatorPass(array('required' => false)),
      'desc_ec'       => new sfValidatorPass(array('required' => false)),
      'rel_en'        => new sfValidatorString(array('max_length' => 127)),
      'rel_fr'        => new sfValidatorString(array('max_length' => 127, 'required' => false)),
      'rel_es'        => new sfValidatorString(array('max_length' => 127, 'required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('character_template[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'characterTemplate';
  }

}
